<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>英脉注册</title>
    <link href="/assets/layui/css/layui.css" rel="stylesheet" type="text/css" />
    <link href="/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/assets/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />
    <link href="/assets/css/animate.min.css" rel="stylesheet" type="text/css" />
    <link href="/assets/css/style.min.css" rel="stylesheet" type="text/css" />
    <link href="/assets/css/common.css" rel="stylesheet" type="text/css" />
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <style type="text/css">
        .ad {
            display: none !important;
            display: none
        }
    </style>
</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <h4>欢迎使用英脉</h4>
            <form class="m-t" role="form" action="/member/member/register.html" id="login_form" method="post">
                <input type="hidden" id="inviteid" name="inviteid" value="{$inviteid}" />
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="手机号" id="mobile" name="mobile" required="" />
                </div>
                <div class="form-group">
                    <div class="col-xs-8 pad0"><input type="text" class="form-control" placeholder="验证码" id="captcha" name="captcha" required="" /></div>
                    <div class="col-xs-4 pad0"><button type="button" id="btnsendsms" class="btn btn-primary block full-width">发送验证码</button></div>
                    <div class="clear"></div>
                </div>
                <div class="form-group">
                    <input type="password" class="form-control" placeholder="密码（6--16位）" id="password" name="password" required="" />
                </div>
                <button type="submit" class="btn btn-primary block full-width m-b">注&nbsp;&nbsp;册</button>
            </form>
        </div>
    </div>
    <script type="text/javascript" src="/assets/libs/jquery/dist/jquery.js"></script>
    <script type="text/javascript" src="/assets/libs/bootstrap/dist/js/bootstrap.min.js?v=3.3.6"></script>
    <script type="text/javascript" src="/assets/layui/layui.js"></script>
    <script type="text/javascript" src="/assets/js/jquery.form.js"></script>
    <script type="text/javascript">
        $(function () {
            var options = {
                beforeSubmit: showStart,
                success: showSuccess
            };
            $('#login_form').submit(function () {
                $(this).ajaxSubmit(options);
                return false;
            });

            function showStart() {
                layui.use(['layer'], function () {
                    var layer = layui.layer;
                    layer.ready(function () {
                        layer.load(0, { shade: false, time: 100 });
                    });
                });
                return true;
            }

            function showSuccess(data) {
                layui.use(['layer'], function () {
                    var layer = layui.layer;
                    layer.ready(function () {
                        if (1 == data.code) {
                            layer.msg(data.msg, { 'time': 2000 });
                            window.location.href = data.url;
                        } else {
                            layer.msg(data.msg, { 'time': 2000 });
                        }
                    });
                });
            }
            $("#btnsendsms").click(function (e) {
                $("#btnsendsms").prop('disabled', 'disabled');
                var s = 20;
                var id = setInterval(function () {
                    s = s - 1;
                    $("#btnsendsms").val('(' + s + ')');
                    if (s == 0) {
                        clearInterval(id);
                        $("#btnsendsms").removeAttr('disabled');
                        $("#btnsendsms").val('发送验证码');
                    }
                }, 1000);
                //请求接口
                $.ajax({
                    type: "post",
                    url: "/api/sms/send.html",
                    data: { mobile: $("#mobile").val() },
                    dataType: 'JSON',
                    success: function (datak) {
                        showSuccess(datak);
                    },
                    error: function () {
                        alert('编辑失败');
                    },
                    complete: function () {
                    }
                });
            });
        });
    </script>
</body>

</html>